package binary;
import java.util.Comparator;
import java.util.Scanner;
import java.util.ArrayList;
import java.util.Iterator;

public class Test {
    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        BinaryTree.TreeNode root = binaryTree.createTree("ABD##E#H##CF##G##");
        binaryTree.preorderTraversal(root);
        System.out.println();
        binaryTree.inorder(root);
    }
}
//做一个东西 可以对任意元素进行排序
class Sort {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        ArrayList<Integer> sort = new ArrayList<>();
        ByNumericalComparison compare = new ByNumericalComparison();
//        while(scanner.hasNext()) {
//            int num = scanner.nextInt();
//            sort.add(num);
//        }
//        //需要传递一个比较器
//        //sort.sort(compare);
//        for (Integer integer : sort) {
//            System.out.print(integer + " ");
//        }
        while(scanner.hasNextLine()) {
            int num = scanner.nextInt();
            sort.add(num);
        }

        for(int i = 0; i < sort.size(); i++) {
            System.out.print(sort.get(i)+" ");
        }
    }
} 
class ByNumericalComparison implements Comparator<Integer> {
    @Override
    public int compare(Integer o1, Integer o2) {
        return o1 - o2;
    }
}
